//
//  MineMoveCarCollectCell.m
//  carcareIOS
//
//  Created by 王然 on 16/9/21.
//  Copyright © 2016年 chezheng. All rights reserved.
//

#import "MineMoveCarCollectCell.h"
#import "carcareIOS-Swift.h"


@interface MineMoveCarCollectCell()

@property (nonatomic , strong) UIView * imageBackV ;//带边框的底view
@property (nonatomic , strong) UIImageView * imageV;//图片view
@property (nonatomic , strong) UIView * fontImageV;//图片view上面蒙板
@property (nonatomic , strong) UILabel * brandL;//车牌label

@end
@implementation MineMoveCarCollectCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createUI];
    }
    return self;
}
- (void)createUI
{
    self.imageBackV = [[[[UIImageView viewWithFrame:CGRectMake(0 , 0, CELL_WIDTH_COLLECTION, 338 * __MAIN_RATIO_375)] setupOnView:self] resetBorderWidth:1 borderColor:[Theme lineNewColor]] resetCornerRadius:2];
    self.imageBackV.hidden = YES;
    CGFloat imageVX = 15 * __MAIN_RATIO_375;
    self.imageV = [[UIImageView imageViewWithFrame:CGRectMake(imageVX, 7 * __MAIN_RATIO_375, self.imageBackV.width - imageVX * 2, 310 * __MAIN_RATIO_375) image:nil] setupOnView:self];
    self.imageV.backgroundColor = [UIColor clearColor];
    self.imageV.contentMode = UIViewContentModeScaleAspectFit;
    self.fontImageV = [[UIView viewWithFrame:self.imageV.frame] setupOnView:self];
    self.fontImageV.backgroundColor = [[UIColor whiteColor]colorWithAlphaComponent:0.8];
    [self.fontImageV setHidden:NO];
    
    self.brandL = [[[UILabel labelWithFrame:CGRectMake(0, self.imageBackV.bottom, self.imageBackV.width, CELL_HEIGHT_COLLECTION - self.imageBackV.bottom) font:FONT_DEFAULT_Light(22) text:@"" textColor:COLOR_HEXSTRING(@"#424242")] setupOnView:self] labelResetTextAlignment:NSTextAlignmentCenter];
    
}
- (void)reloadDataWithModel:(MoveCarQRModel *) model
{
    if(model.styleModel.showQRImage)
    {
        self.imageV.image = model.styleModel.showQRImage;
    }else
    {
        DLog(@"nono");
    }
    
    self.brandL.text = ([model.carno isNotNil] ? model.carno : @"暂无车牌信息");
}

- (void)isCurrentCell:(BOOL)isCurrent
{
//    __weak __typeof(self) wself = self;
//    [NSTimer scheduledTimerWithTimeInterval:0.1 block:^{
        [self.imageBackV setHidden:!isCurrent];
        [self.fontImageV setHidden:isCurrent];
//    } repeats:NO];
}
@end
